import request from '@/utils/request';
import { Pagination } from '@/types/global';

// 岗位数据
export interface PostData {
  id?: number;
  name?: string;
  code?: string;
  sort?: number;
  status?: number;
}

// 查询参数
export interface PostParams extends Partial<PostData> {
  current?: number;
  size?: number;
  startDate?: string;
  endDate?: string;
}

// 岗位列表
export function pagePost(params: PostParams) {
  return request<Pagination<PostData[]>>('get', '/post/page', { params })
}

// 新增岗位
export function savePost(data: PostData) {
  return request('post', '/post', data)
}

// 修改岗位
export function updatePost(data: PostData) {
  return request('put', '/post', data)
}

// 删除岗位
export function deletePost(ids: any) {
  return request('delete', '/post/' + ids)
}
